cd "C:\DRS\"
set matsize 5000

***************************************************
*** Table 2 ***
use HoldingsDatabase.dta, clear

gen xbar = 0
replace xbar = 1 if sheld >0

sort year fundname idcountry
by year fundname: gen y = 1 if idcountry ~= idcountry[_n-1]
by year fundname idcountry: egen ctryhldgsall = sum(xbar)
gen ctryhldgs = ctryhldgsall if y == 1

by year fundname: egen hhlac = sum(ctryhldgs) if lac == 1
by year fundname: egen hhasia = sum(ctryhldgs) if asia == 1
by year fundname: egen hheur = sum(ctryhldgs) if eur == 1  & hi == 1
by year fundname: egen hldgsla = max(hhlac)
by year fundname: egen hldgsasia = max(hhasia)
by year fundname: egen hldgseu = max(hheur)
replace hldgsla = 0 if hldgsla == .
replace hldgsasia = 0 if hldgsasia == .
replace hldgseu = 0 if hldgseu == .
drop hhlac hhasia hheur

replace y = 0 if ctryhldgs < 1
by year fundname: egen cclac = sum(y) if lac == 1
by year fundname: egen ccasia = sum(y) if asia == 1
by year fundname: egen cceur = sum(y) if eur == 1 & hi == 1
by year fundname: egen clac = max(cclac)
by year fundname: egen casia = max(ccasia)
by year fundname: egen ceur = max(cceur)
replace clac = 0 if clac == .
replace casia = 0 if casia == .
replace ceur = 0 if ceur == .
drop cclac  ccasia cceur

sort year fundname idcountry
gen z = 1 if fundname ~= fundname[_n-1] 
drop if z ~= 1
drop z

** Top Panel: No. of Holdings **
bys year family fundtype7: egen hla  = mean(hldgsla)
bys year family fundtype7: egen hasia =mean(hldgsasia)
bys year family fundtype7: egen heu =mean(hldgseu)

by year family: egen world_la = max (hla) if fundtype7 == "World"
by year family: egen for_la = max (hla) if fundtype7 == "Foreign"
by year family: egen em_la = max (hla) if fundtype7 == "Emerging Market"
by year family: egen la_la = max (hla) if fundtype7 == "Latin America"
by year family: egen tworld_la = max (world_la)
by year family: egen tfor_la = max (for_la)
by year family: egen tem_la = max (em_la)
by year family: egen tla_la = max (la_la)
gen dem_la = (tem_la - tla_la)/tla_la
gen dfor_la = (tfor_la - tla_la)/tla_la
gen dworld_la = (tworld_la - tla_la)/tla_la

by year family: egen world_asia = max (hasia) if fundtype7 == "World"
by year family: egen for_asia = max (hasia) if fundtype7 == "Foreign"
by year family: egen em_asia = max (hasia) if fundtype7 == "Emerging Market"
by year family: egen asia_asia = max (hasia) if fundtype7 == "Asia"
by year family: egen tworld_asia = max (world_asia)
by year family: egen tfor_asia = max (for_asia)
by year family: egen tem_asia = max (em_asia)
by year family: egen tasia_asia = max (asia_asia)
gen dem_asia = (tem_asia - tasia_asia)/tasia_asia
gen dfor_asia = (tfor_asia - tasia_asia)/tasia_asia
gen dworld_asia = (tworld_asia - tasia_asia)/tasia_asia

by year family: egen world_eu = max (heu) if fundtype7 == "World"
by year family: egen for_eu = max (heu) if fundtype7 == "Foreign"
by year family: egen eu_eu = max (heu) if fundtype7 == "Europe"
by year family: egen tworld_eu = max (world_eu)
by year family: egen tfor_eu = max (for_eu)
by year family: egen teu_eu = max (eu_eu)
gen dfor_eu = (tfor_eu - teu_eu)/teu_eu
gen dworld_eu = (tworld_eu - teu_eu)/teu_eu

sort year family
gen x = 0
replace x = 1 if family == family[_n-1] & year == year[_n-1]

log using T2.log, replace
** Top Panel: No. of Holdings **
tabstat tla_la dem_la dfor_la dworld_la if x == 0, stats(median)
tabstat tasia_asia dem_asia dfor_asia dworld_asia if x == 0, stats(median)
tabstat teu_eu dfor_eu dworld_eu if x == 0, stats(median)
log close

** Bottom Panel: No. of Countries with Investments **
drop hla hasia heu x
drop world_la for_la em_la la_la
drop tworld_la tfor_la tem_la tla_la
drop dworld_la dfor_la dem_la
drop world_asia for_asia em_asia asia_asia
drop tworld_asia tfor_asia tem_asia tasia_asia
drop dworld_asia dfor_asia dem_asia 
drop world_eu for_eu eu_eu
drop tworld_eu tfor_eu teu_eu
drop dworld_eu dfor_eu 

bys year family fundtype7: egen hla  = mean(clac)
bys year family fundtype7: egen hasia =mean(casia)
bys year family fundtype7: egen heu =mean(ceu)

*LA hldgs
by year family: egen world_la = max (hla) if fundtype7 == "World"
by year family: egen for_la = max (hla) if fundtype7 == "Foreign"
by year family: egen em_la = max (hla) if fundtype7 == "Emerging Market"
by year family: egen la_la = max (hla) if fundtype7 == "Latin America"
by year family: egen tworld_la = max (world_la)
by year family: egen tfor_la = max (for_la)
by year family: egen tem_la = max (em_la)
by year family: egen tla_la = max (la_la)
gen dem_la = (tem_la - tla_la)/tla_la
gen dfor_la = (tfor_la - tla_la)/tla_la
gen dworld_la = (tworld_la - tla_la)/tla_la

*Asia hldgs
by year family: egen world_asia = max (hasia) if fundtype7 == "World"
by year family: egen for_asia = max (hasia) if fundtype7 == "Foreign"
by year family: egen em_asia = max (hasia) if fundtype7 == "Emerging Market"
by year family: egen asia_asia = max (hasia) if fundtype7 == "Asia"
by year family: egen tworld_asia = max (world_asia)
by year family: egen tfor_asia = max (for_asia)
by year family: egen tem_asia = max (em_asia)
by year family: egen tasia_asia = max (asia_asia)
gen dem_asia = (tem_asia - tasia_asia)/tasia_asia
gen dfor_asia = (tfor_asia - tasia_asia)/tasia_asia
gen dworld_asia = (tworld_asia - tasia_asia)/tasia_asia

*Europe hldgs
by year family: egen world_eu = max (heu) if fundtype7 == "World"
by year family: egen for_eu = max (heu) if fundtype7 == "Foreign"
by year family: egen eu_eu = max (heu) if fundtype7 == "Europe"
by year family: egen tworld_eu = max (world_eu)
by year family: egen tfor_eu = max (for_eu)
by year family: egen teu_eu = max (eu_eu)
gen dfor_eu = (tfor_eu - teu_eu)/teu_eu
gen dworld_eu = (tworld_eu - teu_eu)/teu_eu

sort year family
gen x = 0
replace x = 1 if family == family[_n-1] & year == year[_n-1]

log using T2.log, append
** Bottom Panel: No. of Countries with Investments **
tabstat tla_la dem_la dfor_la dworld_la if x == 0, stats(median)
tabstat tasia_asia dem_asia dfor_asia dworld_asia if x == 0, stats(median)
tabstat teu_eu dfor_eu dworld_eu if x == 0, stats(median)
log close
***************************************************


***************************************************
*** Table 4 ***

use NoListedFirms.dta, clear
drop if idcountry == "CANADA"

log using T4.log, replace
** No. of Listed Stocks (from Global Financial Database) **
preserve
collapse (sum) nlist, by(year)
tabstat nlist if year == 1997
tabstat nlist if year == 2004
restore

preserve
collapse (sum) nlist, by(income year)
tabstat nlist if year == 1997 , by(income)
tabstat nlist if year == 2004, by(income)
restore

preserve
collapse (sum) nlist, by(income region year)
tabstat nlist if year == 1997 & income == "High Income", by(region)
tabstat nlist if year == 1997 & income != "High Income", by(region)
tabstat nlist if year == 2004 & income == "High Income", by(region)
tabstat nlist if year == 2004 & income != "High Income", by(region)
restore
log close

** Stats on No. of Holdings **
use HoldingsDatabase.dta, clear
sort year id
gen noholdings = 0
by year: replace noholdings =1 if id ~= id[_n-1] 
collapse (sum) noholdings, by(idcountry year)
sort idcountry year
merge idcountry year using NoListedFirms.dta
drop if _merge == 1
drop _merge
drop if idcountry == "CANADA"

log using T4.log, append
** The dataset has been revised and updated since the publication of the paper **
** The statistics on the following panels/columns are based on this revised dataset and differ slightly **
** from those reported in the paper **

** No. of Holdings: All Funds **
preserve
collapse (sum) nohold, by(year)
tabstat nohold if year == 1997
tabstat nohold if year == 2004
restore

preserve
collapse (sum) nohold, by(income year)
tabstat nohold if year == 1997 , by(income)
tabstat nohold if year == 2004, by(income)
restore

preserve
collapse (sum) nohold, by(income region year)
tabstat nohold if year == 1997 & income == "High Income", by(region)
tabstat nohold if year == 1997 & income != "High Income", by(region)
tabstat nohold if year == 2004 & income == "High Income", by(region)
tabstat nohold if year == 2004 & income != "High Income", by(region)
restore
log close

use HoldingsDatabase.dta, clear
keep if fundtype2 == "Global"
sort year id
gen noholdings = 0
by year: replace noholdings =1 if id ~= id[_n-1] 
collapse (sum) noholdings, by(idcountry year)
sort idcountry year
merge idcountry year using NoListedFirms.dta
drop if _merge == 1
drop _merge
drop if idcountry == "CANADA"

log using T4.log, append
** No. of Holdings: Global Funds **
preserve
collapse (sum) nohold, by(year)
tabstat nohold if year == 1997
tabstat nohold if year == 2004
restore

preserve
collapse (sum) nohold, by(income year)
tabstat nohold if year == 1997 , by(income)
tabstat nohold if year == 2004, by(income)
restore

preserve
collapse (sum) nohold, by(income region year)
tabstat nohold if year == 1997 & income == "High Income", by(region)
tabstat nohold if year == 1997 & income != "High Income", by(region)
tabstat nohold if year == 2004 & income == "High Income", by(region)
tabstat nohold if year == 2004 & income != "High Income", by(region)
restore
log close
***************************************************

***************************************************
*** Table 5 ***
use HoldingsDatabase.dta, clear

gen world = 0
replace world = 1 if fundtype7 == "World"
gen foreign = 0
replace foreign = 1 if fundtype7 == "Foreign"
gen specialized = 0
replace specialized = 1 if fundtype2 == "Specialized"

sort family year id
by family year id: egen g1 = max(world)
by family year id: egen i1 = max(foreign)
by family year id: egen r1 = max(specialized)

by family year: egen kg = max(world)
by family year: egen ki = max(foreign)
by family year: egen kr = max(specialized)

gen kall = kg + ki
replace kall = 1 if kall ==2

gen rasia = 0
replace rasia = 1 if fundtype7 == "Japan Country Fund"
replace rasia = 1 if fundtype7 == "Asia"
gen reurope = 0
replace reurope = 1 if fundtype7 == "Europe"
gen rlac = 0
replace rlac = 1 if fundtype7 == "Latin America"
gen rem = 0
replace rem = 1 if fundtype7 == "Emerging Market"

by family year: egen kasia = max(rasia)
by family year: egen klac = max(rlac)
by family year: egen keur = max(reurope)
by family year: egen kem = max(rem)

replace r1 = 2 if asia == 1 & hi == 1 &  kasia == 0 & r1 == 0 
replace r1 = 2 if asia == 1 & hi == 0 & kasia == 0 & kem == 0 & r1 == 0
replace r1 = 2 if lac == 1 & hi == 1 &  klac == 0 & r1 == 0
replace r1 = 2 if lac == 1 & hi == 0 &  klac == 0 &  kem == 0 & r1 == 0
replace r1 = 2 if eur == 1 & hi == 1 &  keur == 0 & r1 == 0
replace r1 = 2 if eur == 1 & hi == 0 &  keur == 0 &  kem == 0 & r1 == 0

sort family year id
gen x = 0
replace x = 1 if id ~=id[_n-1]

gen gall = g1
replace gall = 1 if i1 == 1 

log using T5.log, replace
*Probabilities: Global vs. Specialized Funds
tabulate r1 gall if x ==1 & kr ==1 & kall == 1, cell
log close
***************************************************



***************************************************
*** Figure 3 ***
use HoldingsDatabase.dta, clear
sort year id
gen noholdings = 0
by year: replace noholdings =1 if id ~= id[_n-1] 
collapse (sum) noholdings, by(idcountry year)
sort idcountry year
merge idcountry year using NoListedFirms.dta
drop if _merge == 1
drop _merge
sort drop idcountry year

bys year: egen china_all = sum(nlist) if (idcountry == "CHINA"|idcountry == "HONG KONG"|idcountry == "TAIWAN"|idcountry == "MACAO, CHINA")
replace nlist = china_all if idcountry == "CHINA"
drop china_all

replace noholdings = 0 if noholdings == .
bys year: egen china_all = sum(noholdings) if (idcountry == "CHINA"|idcountry == "HONG KONG"|idcountry == "TAIWAN"|idcountry == "MACAO, CHINA")
replace noholdings = china_all if idcountry == "CHINA"
drop if idcountry == "HONG KONG"
drop if idcountry == "TAIWAN"
drop if idcountry == "MACAO, CHINA"
drop china_all

drop if drop == 1
drop drop

gen ratio = noholdings/nlistfirms
bys idcountry: egen avg_ratio = mean(ratio)

log using F3.log, replace
** Mutual Fund Holdings as a Proportion of the Total No. of Holdings **
** By Country **
** The dataset has been revised and updated since the publication of the paper **
** The statistics on this figure are based on this revised dataset and differ slightly **
** from those reported in the paper **
tabstat avg_ratio if avg_ratio~=., by(idcountry)
log close
***************************************************

***************************************************
*** Figure 4 ***
** Top Panel **
use HoldingsDatabase.dta, clear
gen nav = (perc_netassets/100)*na
bys fundname year: egen teste = sum(perc_netassets)
drop if teste > 110
drop teste

gen world = 0
replace world = 1 if fundtype7 == "World"
gen foreign = 0
replace foreign = 1 if fundtype7 == "Foreign"
gen specialized = 0
replace specialized = 1 if fundtype2 == "Specialized"

sort family year id
by family year id: egen g1 = max(world)
by family year id: egen i1 = max(foreign)
by family year id: egen r1 = max(specialized)
gen gall = g1 + i1
replace gall = 1 if gall == 2

sort family year
gen dgir = 0
replace dgir = 1 if  r1 == 1 &  gall == 1
replace dgir = 0 if dgir == 1 & foreign == 0 & specialized == 0 & world == 0
by family year : egen navgir1 = sum(nav)  if  dgir == 1 
by family year : egen navgir = max(navgir1)  
by family year : egen navtot_g = sum(nav)  if world == 1
by family year : egen navtot_i = sum(nav)  if foreign == 1
by family year : egen navtot_r = sum(nav)  if specialized == 1
by family year : egen navt_g = max(navtot_g)
by family year : egen navt_i = max(navtot_i)
by family year : egen navt_r = max(navtot_r)
gen ntot_gir = navt_i + navt_g + navt_r
gen rgir= navgir/ntot_gir

sort family year
gen z = 0
replace z = 1 if year ~=year[_n-1]
replace z = 1 if family ~=family[_n-1]
drop if z == 0

log using F4.log, replace
** Top Panel **
** Within-Family Entropy **
** Dashed lines are the median plus/minus the std. dev. **
tabstat rgir ,  stats(median) by(year)
tabstat rgir ,  stats(sd) by(year)
log close


** Bottom Panel **
log using F4.log, append 
** Bottom Panel **
** Within-Family Entropy: by No. of Common Managers **
tabstat rgir ,  stats(median) by(year)
tabstat rgir if ncm == 0,  stats(median) by(year)
tabstat rgir if ncm >= 1,  stats(median) by(year)
tabstat rgir if ncm >3,  stats(median) by(year)
log close
***************************************************


***************************************************
*** Table 6 ***
tabulate year, gen(y)
tab family, gen(f)
tab ncm, gen(ncm)
replace ncm8 = 1 if ncm9 == 1
replace ncm8 = 1 if ncm10 == 1
drop ncm9 ncm10
rename ncm1 ncm0
rename ncm2 ncm1
rename ncm3 ncm2
rename ncm4 ncm3
rename ncm5 ncm4
rename ncm6 ncm5
rename ncm7 ncm6
rename ncm8 ncm7

gen ncm_one = ncm1
replace ncm_one = 1 if ncm2 == 1
replace ncm_one = 1 if ncm3 == 1
replace ncm_one = 1 if ncm4 == 1
replace ncm_one = 1 if ncm5 == 1
replace ncm_one = 1 if ncm6 == 1
replace ncm_one = 1 if ncm7 == 1

gen ncm_three = ncm3
replace ncm_three = 1 if ncm4 == 1
replace ncm_three = 1 if ncm5 == 1
replace ncm_three = 1 if ncm6 == 1
replace ncm_three = 1 if ncm7 == 1

label var ncm0 "No Common Manager"
label var ncm1 "1 Common Manager"
label var ncm2 "2 Common Managers"
label var ncm3 "3 Common Managers"
label var ncm4 "4 Common Managers"
label var ncm5 "5 Common Managers"
label var ncm6 "6 Common Managers"
label var ncm7 "7 or More Common Managers"
label var ncm_one "At Least 1 Common Manager"
label var ncm_three "At Least 3 Common Managers"

log using T6.log, replace
reg rgir ncm, robust
local adjusted = e(r2_a)
outreg2 using T6.xls, lab keep(ncm) adds(Adjusted,`adjusted') replace
reg rgir ncm y1-y9 , robust
local adjusted = e(r2_a)
outreg2 using T6.xls, append lab keep(ncm) adds(Adjusted,`adjusted') 
reg rgir ncm0 ncm1 ncm2 ncm_three, robust nocons
local adjusted = e(r2_a)
outreg2 using T6.xls, append lab keep(ncm0 ncm1 ncm2 ncm_three) adds(Adjusted,`adjusted') 
test ncm0 = ncm1
test ncm0 = ncm2
test ncm0 = ncm_three
reg rgir ncm0 ncm1 ncm2 ncm_three  y1-y9, robust nocons
local adjusted = e(r2_a)
outreg2 using T6.xls, append lab keep(ncm0 ncm1 ncm2 ncm_three) adds(Adjusted,`adjusted') 
test ncm0 = ncm1
test ncm0 = ncm2
test ncm0 = ncm_three
log close
***************************************************

***************************************************
*** Appendix Figure 3 ***
** Top Panel **
use HoldingsDatabase.dta, clear

bys fundname year: egen teste = sum(perc_netassets)
drop if teste > 110
drop teste

drop if perc_netassets == 0
gen nav = (perc_netassets/100)*na

sort ticker family year id
gen t = 0
replace t = 1 if ticker==ticker[_n-1] & year==year[_n-1] & id==id[_n-1] 
by ticker family year id: egen navid = sum(nav)
drop if t == 1
drop nav t
rename navid nav
by ticker  family  year: egen tnav = sum(nav)

gen t = 0
sort ticker family id year
gen lyear = year - 1
by ticker family id: replace t = 1 if id == id[_n-1] & year[_n-1] == lyear
by ticker family id: gen commont = nav if t == 1
by ticker family id: gen commont1 = nav[_n-1] if t == 1
by ticker family id: gen common = commont + commont1

sort ticker family id year
by ticker family id: gen ltnav2  = tnav[_n-1] if t == 1
sort ticker family year
by ticker family year: egen ltnav = max(ltnav2)

sort ticker family year
by ticker family year: egen scom = sum(common)
by ticker family year: gen snav = tnav + ltnav
gen entropy = scom/snav

sort ticker family year id
gen x = 0
replace x = 1 if ticker == ticker[_n-1] & year == year[_n-1] & family == family[_n-1]
drop if x == 1
drop x

log using AF3.log, replace
*** Appendix Figure 3 ***
** Top Panel **
tabstat entropy if fundtype7 == "World", stats(p50) by(year)
tabstat entropy if fundtype7 == "Foreign", stats(p50) by(year)
tabstat entropy if fundtype2 == "Specialized", stats(p50) by(year)
log close

** Bottom Panel **
use HoldingsDatabase.dta, clear
drop if hi == 1
drop if perc_netassets == 0
gen nav = (perc_netassets/100)*na

sort ticker  family year id
gen t = 0
replace t = 1 if ticker==ticker[_n-1] & year==year[_n-1] & id==id[_n-1] 
by ticker  family year id: egen navid = sum(nav)
drop if t == 1
drop nav t
rename navid nav

by ticker  family  year: egen tnav = sum(nav)
gen t = 0
sort ticker family id year
gen lyear = year - 1
by ticker family id: replace t = 1 if id == id[_n-1] & year[_n-1] == lyear
by ticker family id: gen commont = nav if t == 1
by ticker family id: gen commont1 = nav[_n-1] if t == 1
by ticker family id: gen common = commont + commont1

sort ticker family id year
by ticker family id: gen ltnav2  = tnav[_n-1] if t == 1
sort ticker family year
by ticker family year: egen ltnav = max(ltnav2)

sort ticker family year
by ticker family year: egen scom = sum(common)
by ticker family year: gen snav = tnav + ltnav
gen entropy = scom/snav

sort ticker family year id
gen x = 0
replace x = 1 if ticker == ticker[_n-1] & year == year[_n-1] & family == family[_n-1]
drop if x == 1
drop x

log using AF3.log, append
*** Appendix Figure 3 ***
** Bottom Panel **
tabstat entropy if fundtype7 == "World", stats(p50) by(year)
tabstat entropy if fundtype7 == "Foreign", stats(p50) by(year)
tabstat entropy if fundtype2 == "Specialized", stats(p50) by(year)
log close
***************************************************


***************************************************
*** Appendix Table 6 ***
use HoldingsDatabase.dta, clear
drop if hi == 1

gen world = 0
replace world = 1 if fundtype7 == "World"
gen foreign = 0
replace foreign = 1 if fundtype7 == "Foreign"
gen specialized = 0
replace specialized = 1 if fundtype2 == "Specialized"

sort family year id
by family year id: egen g1 = max(world)
by family year id: egen i1 = max(foreign)
by family year id: egen r1 = max(specialized)

by family year: egen kg = max(world)
by family year: egen ki = max(foreign)
by family year: egen kr = max(specialized)

gen kall = kg + ki
replace kall = 1 if kall ==2

gen rasia = 0
replace rasia = 1 if fundtype7 == "Asia"
gen reurope = 0
replace reurope = 1 if fundtype7 == "Europe"
gen rlac = 0
replace rlac = 1 if fundtype7 == "Latin America"
gen rem = 0
replace rem = 1 if fundtype7 == "Emerging Market"

by family year: egen kasia = max(rasia)
by family year: egen klac = max(rlac)
by family year: egen keur = max(reurope)
by family year: egen kem = max(rem)

replace r1 = 2 if asia == 1 & hi == 1 &  kasia == 0 & r1 == 0 
replace r1 = 2 if asia == 1 & hi == 0 & kasia == 0 & kem == 0 & r1 == 0
replace r1 = 2 if lac == 1 & hi == 1 &  klac == 0 & r1 == 0
replace r1 = 2 if lac == 1 & hi == 0 &  klac == 0 &  kem == 0 & r1 == 0
replace r1 = 2 if eur == 1 & hi == 1 &  keur == 0 & r1 == 0
replace r1 = 2 if eur == 1 & hi == 0 &  keur == 0 &  kem == 0 & r1 == 0

sort family year id
gen x = 0
replace x = 1 if id ~=id[_n-1]

gen gall = g1
replace gall = 1 if i1 == 1 

log using AT6.log, replace
** Probabilities: Global vs. Specialized Funds **
** Holdings in Developing Countries Only **
tabulate r1 gall if x ==1 & kr ==1 & kall == 1, cell
log close
***************************************************

***************************************************
*** Appendix Table 5 ***
use HoldingsDatabase.dta, clear

gen r1 = (((perc_netassets/100)*na)/mcap)*100
sort id year
by id year: egen total1 = sum(r1)

log using AT5.log, replace
** Size of Mutual Fund Holdings **
** Value of Holding over Market Capitalization **
tabstat r1 if total1 < 100 & fundtype2 == "Global", stats (mean p50 sd) 
tabstat r1 if total1 < 100 & fundtype7 == "World", stats (mean p50 sd) 
tabstat r1 if total1 < 100 & fundtype7 == "Foreign", stats (mean p50 sd) 
tabstat r1 if total1 < 100 & (fundtype7 == "Emerging Market"|fundtype7 == "Asia"|fundtype7 == "Latin America"|fundtype7 == "Europe"), stats (mean p50 sd) 
tabstat r1 if total1 < 100 & fundtype7 == "Emerging Market", stats (mean p50 sd) 
tabstat r1 if total1 < 100 & fundtype7 == "Asia", stats (mean p50 sd) 
tabstat r1 if total1 < 100 & fundtype7 == "Europe", stats (mean p50 sd) 
tabstat r1 if total1 < 100 & fundtype7 == "Latin America", stats (mean p50 sd) 
log close

sort fundname year
gen x = 0
replace x = 1 if fundname == fundname[_n-1] & year == year[_n-1]

log using AT5.log, append
** Average Mutual Fund Size **
** The dataset has been revised and updated since the publication of the paper **
** The statistics on the following panel are based on this revised dataset and differ slightly **
** from those reported in the paper **
tabstat na if x == 0 & fundtype2 == "Global", stats (mean) 
tabstat na if x == 0 & fundtype7 == "World", stats (mean) 
tabstat na if x == 0 & fundtype7 == "Foreign", stats (mean) 
tabstat na if x == 0 & (fundtype7 == "Emerging Market"|fundtype7 == "Asia"|fundtype7 == "Latin America"|fundtype7 == "Europe"), stats (mean) 
tabstat na if x == 0 & fundtype7 == "Emerging Market", stats (mean) 
tabstat na if x == 0 & fundtype7 == "Asia", stats (mean) 
tabstat na if x == 0 & fundtype7 == "Europe", stats (mean) 
tabstat na if x == 0 & fundtype7 == "Latin America", stats (mean) 
log close
***************************************************





